{include file="header/index" /}
<div class="newContentBox">
	<div class="fixedFather">
		<div class="fix">
			客户详情--
			<a class="cover_new_aheadlink cover_new_on" href="javascript:void(0)" >基本信息</a>
			<a class="cover_new_aheadlink" href="javascript:void(0)" >客户标签</a>
			<a class="cover_new_aheadlink" href="javascript:void(0)" >跟进记录</a>
			<div class="newFixBtnBox">
				<button type="button" class="newBtnDefault newBtnGray" onclick="returnBack(this)"> <i class="fa fa-mail-reply"></i>返回</button>
			</div>
		</div>
	</div>
</div>
<div class="workDetail">
    <div class="workrall">
    	<!-- 基本信息 -->
    	<div class="workTitle clientTitle">
    		<img class="iconTitleimg iconTimg2" src="__IMG__/ordericon1.png" >
    		基本信息
    	</div>
    	<div class="work_left_conten client_left_conten">
    		<div class="client_newLe">
    			<div class="client_info">
    				<img class="client_img" src="__IMG__/Head_img.jpg" class="infoImg" onerror="this.src='__IMG__/Head_img.jpg'">
    				<div class="client_status">状态 <span>{$data.account_status == 1 ? '正常' : '冻结'}</span></div>
    			</div>
    			<div class="client_msg">
    				<p class="client_name">姓名：{$data.realname}
						<img src="{$data.gender == 1 ? '__IMG__/icon5.png' : '__IMG__/icon6.png'}" alt="">
					</p>
    				<p>性&nbsp;&nbsp;别：{$data.gender_name}</p>
    				<p>联系电话：{$data.telphone}</p>
    				<p>生&nbsp;&nbsp;日：{$data.birthday ? $data.birthday : '--'}</p>
    				<p>身份证号：{$data.id_card ? $data.id_card : '--'}</p>
    			</div>
    		</div>
    		<div class="client_newRi">
    			<div class="client_one33">
    				<p>微信：{$data.contact_weixin ? $data.contact_weixin : '--'}</p>
    				<p>QQ：{$data.contact_qq ? $data.contact_qq : '--'}</p>
    				<p>邮箱：{$data.contact_email ? $data.contact_email : '--'}</p>
    				<p>有效期：{$data.last_be_related_expire_time}</p>
    			</div>
    			<div class="client_one33">
    				<p>客户地址：{$data.three}</p>
    				<p>客户阶段：{$data.stage_name}</p>
    				<p>客户等级：{$data.grade_name}</p>
    				<p>备注：{$data.remark ? $data.remark : '--'}</p>
    			</div>
    			<div class="client_one33">
    				<p>客户来源：{$data.source_type_name ? $data.source_type_name : '--'}</p>
    				<p>企业信息：{$data.company_name ? $data.company_name : '--'}</p>
    				<p>所属员工：{$data.source ? $data.source : '--'}</p>
    			</div>
    		</div>
    	</div>

    	<!-- 信息 -->
    	<div class="workTitle work_t_bor">
			<img class="iconTitleimg iconTimg2" src="__IMG__/ordericon11.png">
    		客户标签
    	</div>
    	<div class="work_left_conten">
			{if condition="$data.label_name"}
				{volist name="$data.label_name" id="k"}
					<span class="newTag">
						{$k.name}
					</span>
				{/volist}
			{else}
				--
			{/if}
    	</div>
		<!--记录-->
		<input type="hidden" id="user_id" value="{$data.user_id}" />
		<input type="hidden" id="page" value="1" />
    	<div class="work_left_conten order_fold pad_btm_30" id="record">
			<div class="layui-collapse">
				  <div class="layui-colla-item">
					  <h2 class="layui-colla-title cover_layui_c_i"><img class="iconTitleimg iconTimg2" src="__IMG__/ordericon11.png" >跟进记录</h2>
					  <div class="layui-colla-content layui-show record_list">
						  <span class="lf_span_80" id="Load">加载中...</span>
					  </div>
					  <div class="more">
					  	<button onclick="getRecord()"></button>
					  </div>
				  </div>
			</div>
    	</div>
    </div>
</div>
<script>
	var element = layui.element;
	element.render();

	$(function () {
        getRecord();
	});
    // 获取跟进记录
	function getRecord() {
		var user_id = parseInt($("#user_id").val());
	    var page = parseInt($('#page').val());
	    var pageSize = 10;
		$.ajax({
			type:'post',
			datatype:'json',
			url:"{:url('Customer/record')}",
			data:{ page: page, user_id: user_id, pageSize: pageSize },
			success: function (data) {
                $("#Load").remove();
				if (data.code == 1000){
				    $('#page').val(data.nowPage);
				    var info = '';
				    $.each(data.data,function (k,v) {
				        info += '<p class="p_one_box"><span class="lf_span_80">' +
							'【员工:'+ v.workers_name +'】在' +
							'【'+ v.follow_time +'】' +
                            '【'+ v.follow_type_name +'】跟进' +
							'【客户:'+ v.realname +'】跟进状态' +
							'【'+ v.status_name +'】跟进内容' +
							'【'+ v.content +'】</span>' +
							'</p>'
				    })
				    $("#record").find(".record_list").append(info);
				    var str = '<button onclick="getRecord()">查看更多</button>';
				    if (data.data.length < pageSize) {
                        str = '<span>没有更多了~</span>'
					}
                    $("#record").find(".more").html(str);
				}
				else{
                    var str = '<span>没有更多了~</span>'
                    if (data.count < 1) {
                        str = '<span>暂无记录~</span>'
                    }
                    $("#record").find(".more").html(str);
				}
			},
		});
	}

</script>